package com.github.hwangrq.minicat.servlet;


import com.github.hwangrq.minicat.server.Request;
import com.github.hwangrq.minicat.server.Response;

/**
 * @author hwangrq
 * @date 2021/3/14 14:28
 * @description
 */
public abstract class HttpServlet implements Servlet {

    public abstract void doGet(Request request, Response response);

    public abstract void doPost(Request request, Response response);

    @Override
    public void service(Request request, Response response) throws Exception {
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }
}
